package com.xyz.springboot_webapi_learning.controller;


import com.xyz.springboot_webapi_learning.mapper.StudentMapper;
import com.xyz.springboot_webapi_learning.util.RestResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;



/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xyz
 * @since 2020-05-28
 */
@RestController
@RequestMapping("/api/v1/student")
public class StudentController {

    @Autowired
    private StudentMapper studentMapper;

    //@CrossOrigin(origins = "http://localhost:9000")
    //用来返回所有学生信息
    @GetMapping("/all")
    public RestResult all(){
        return RestResult.success(studentMapper.selectList(null));
    }

}
